const convertHTML = str => {
  const entities = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    "'": '&apos;'
  };
  let newStr = '';
  for (let char of str) {
    if (char in entities) char = entities[char];
    newStr += char;
  }
  return newStr;
}

let output = convertHTML("Sixty > twelve");
console.log(output);